<template>
    <div class="coverBox">
        <div v-show="props.cover !== null">
            <a 
            class="book-container"
            href=""
            target="_blank"
            rel="noreferrer noopener"
            >
            <div class="book coverImage">
                <img
                alt=""
                :src="props.cover"
                />
            </div>
            </a>
        </div>
        <div v-show="props.cover == null">
            <nut-skeleton width="250px" height="15px" animated> </nut-skeleton>
        </div>
    </div>
</template>

<script setup>
const props = defineProps([
    'cover'
])
</script>

<style scoped>
.coverBox {
    box-sizing: content-box;
    width: 99vw;
    height: 40vh;
    /* border: 1px solid #000; */
    text-align: center;
}

.coverImage {
    margin: 80px auto;
    width: 160px;
}
.book-container {
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 500px;
}

@keyframes initAnimation {
  0% {
    transform: rotateY(-12deg);
  }
  100% {
    transform: rotateY(-38deg);
  }
}

.book {
  width: 150px;
  height: 225px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(-38deg);
  transition: 1s ease;
  animation: 1s ease 0s 1 initAnimation;
}

.book-container:hover .book, 
.book-container:focus .book {
  transform: rotateY(-12deg);
}

.book > :first-child {
  position: absolute;
  top: 0;
  left: 0;
  background-color: red;
  width: 150px;
  height: 225px;
  transform: translateZ(15px);
  background-color: #141415;
  border-radius: 0 5px 5px 0;
  box-shadow: 5px 5px 20px #666;
}

.book::before {
  position: absolute;
  content: ' ';
  background-color: blue;
  left: 0;
  top: 5px;
  width: 28px;
  height: 215px;
  transform: translateX(130px) rotateY(90deg);
  background: linear-gradient(90deg, 
    #fff 0%,
    #f9f9f9 5%,
    #fff 10%,
    #f9f9f9 15%,
    #fff 20%,
    #f9f9f9 25%,
    #fff 30%,
    #f9f9f9 35%,
    #fff 40%,
    #f9f9f9 45%,
    #fff 50%,
    #f9f9f9 55%,
    #fff 60%,
    #f9f9f9 65%,
    #fff 70%,
    #f9f9f9 75%,
    #fff 80%,
    #f9f9f9 85%,
    #fff 90%,
    #f9f9f9 95%,
    #fff 100%
    );
}

.book::after {
  position: absolute;
  top: 0;
  left: 0;
  content: ' ';
  width: 150px;
  height: 225px;
  transform: translateZ(-15px);
  background-color: #141415;
  border-radius: 0 5px 5px 0;
  box-shadow: -10px 0 50px 10px #666;
}
</style>